const mongoose = require('mongoose');
const baseModel = require('./base_model')
const Schema = mongoose.Schema
const md5 = require('../util/md5')
const userSchema = new Schema({
    ...baseModel,
    username:{
        type:String,
        required:true,
    },
    password:{
        type:String,
        default:null,
        set:value=>md5(value),
        select:false
    },
    email:{
        type:String,
        default:null,
    },
    bie:{
        type:String,
        default:null,
    },
    image:{
        type:String,
        default:null,
    },
    
},{collection:'user'})

module.exports = userSchema